﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin_ManagePartnerCats : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void gvwPartCats_SelectedIndexChanged(object sender, EventArgs e)
    {
        dvwCurrPartCat.ChangeMode(DetailsViewMode.Edit);
    }
    protected void gvwPartCats_RowDeleted(object sender, GridViewDeletedEventArgs e)
    {
        gvwPartCats.SelectedIndex = -1;
        gvwPartCats.DataBind();
        dvwCurrPartCat.ChangeMode(DetailsViewMode.Insert);
    }
    protected void gvwPartCats_RowCreated(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ImageButton btn = e.Row.Cells[4].Controls[0] as ImageButton;
            btn.OnClientClick = "if (confirm('Bạn có chắc là bạn muốn xóa giới thiệu này không?') == false) return false;";
        }
    }
    protected void dvwCurrPartCat_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
    {
        gvwPartCats.SelectedIndex = -1;
        gvwPartCats.DataBind();
    }
    protected void dvwCurrPartCat_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
    {
        gvwPartCats.SelectedIndex = -1;
        gvwPartCats.DataBind();
    }
    protected void dvwCurrPartCat_ItemCommand(object sender, DetailsViewCommandEventArgs e)
    {
        if (e.CommandName == "Cancel")
        {
            gvwPartCats.SelectedIndex = -1;
            gvwPartCats.DataBind();
        }
    }
}
